package cz.acies.genea.data.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;

import org.apache.commons.dbutils.BeanProcessor;

import cz.acies.genea.data.persist.GedFamily;

public class GedPersonBeanProcessor extends BeanProcessor
{
	public GedPersonBeanProcessor() {
		super();
	}

	public GedPersonBeanProcessor(Map<String, String> columnToPropertyOverrides) {
		super(columnToPropertyOverrides);
	}

	@Override
	protected Object processColumn(ResultSet rs, int index, Class<?> propType) throws SQLException {
		//System.out.println("BeanProcessor.processColumn("+index+",  "+propType+")");
		if (propType == GedFamily.class) {
			String id = rs.getString(index);
			return new GedFamily(id);
		} else {
			return super.processColumn(rs, index, propType);
		}
	}

}
